#: import ew kivy.uix.effectwidget
#: import os os
#: set path_to_songs 'assets/music/'

<MusicScreen>:
    EffectWidget:
        effects: [ew.VerticalBlurEffect(size=10), ew.HorizontalBlurEffect(size=10)]
        FitImage:
            source: 'assets/image/bingbing.png'

    MDBoxLayout:
        orientation: 'vertical'
        padding: ['10dp', '30dp', '10dp', '50dp']
        SongCover:
            id: sc
            size: (250, 250)
            size_hint: None, None
            pos_hint: {'center_x': .5}
            RotatingImage:
                angle: sc.angle
                source: 'assets/image/bingbing.png'
                radius: [250, 250]
        Widget:
            size_hint: None, None
            height: '25dp'
        Label:
            text: '歌曲：' + sc.songName
            bold: True
            font_size: '20sp'
            font_name: 'msyh'
            size_hint_y: None
            height: self.texture_size[1]
        MDBoxLayout:
            orientation: 'vertical'
            Slider:
                id: progress
                color: [.7, 0, 0, 1]
                min: 0
                max: sc.songLength
                value: 0
                background_width: '20dp'
                cursor_size: ('15dp', '15dp')
                value_track_color: [0, 0, 0, 1]
                value_track: True
            MDBoxLayout:
                AnchorLayout:
                    MyIcon:
                        icon: 'restart'
                AnchorLayout:
                    MyIcon:
                        icon: 'skip-previous-outline'
                        on_press: sc.play_prev(progress)
                AnchorLayout:
                    MyIcon:
                        icon: sc.pausePlay
                        on_press: sc.play(progress)
                AnchorLayout:
                    MyIcon:
                        icon: 'skip-next-outline'
                        on_press: sc.play_next(progress)
                AnchorLayout:
                    MyIcon:
                        icon: 'format-list-bulleted'
                        on_release:
                            root.manager.current='songList'
                            root.manager.transition.direction='left'

<SongListScreen>
    canvas.before:
        Rectangle:
            pos: self.pos
            size: self.size
            source: 'assets/image/bingbing.png'
    MDBoxLayout:
        orientation: 'vertical'

        Label:
            text: ""
        BackgroundLabel:
            markup: True
            text: "[b]播放列表[/b]\n\n" + "\n".join(os.listdir(path_to_songs)) 
            font_name: 'msyh'
            font_size: '15sp'
            color: [1, 1, 1, 1]
            background_color: 1, 1, 1, 1
        AnchorLayout:
            MyIcon:
                icon: 'heart'
                on_release:
                    root.manager.current='main'
                    root.manager.transition.direction='right'
                        

<MyIcon@MDIconButton>:
    color: [.7, 0, 0, 1]
    size_hint: None, None
    user_font_size: '30sp'
    theme_text_color: 'Custom'
    size: ('20dp', '20dp')
    text_color: [1, 1, 1, 1]

<RotatingImage@FitImage>:
    angle: 0
    canvas.before:
        PushMatrix
        Rotate:
            angle: root.angle
            origin: self.center
    canvas.after:
        PopMatrix

<BackgroundColor@Widget>
    background_color: 1, 1, 1, 1
    opacity: 0.5
    canvas.before:
        Color:
            rgba: [0, 0, 0, 1]
        Rectangle:
            size: self.size
            pos: self.pos

<BackgroundLabel@Label+BackgroundColor>
    background_color: 0, 0, 0, 0
